/**
 * @author zyj
 * @date 2022年06月06日 15:02
 */
public class 线程的优先级 {
    public static void main(String[] args) {

       Thread t1 = new Thread("线程A"){
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(getName() + ":" + i);
                }
            }
        };
       t1.setPriority(Thread.MIN_PRIORITY);
       t1.start();

        Thread t2 = new Thread("线程B"){
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(getName() + ":" + i);
                }
            }
        };
        t2.setPriority(Thread.NORM_PRIORITY);
        t2.start();


        Thread t3 = new Thread("线程C"){
            @Override
            public void run() {
                for (int i = 0; i < 100; i++) {
                    System.out.println(getName() + ":" + i);
                }
            }
        };
        t3.setPriority(Thread.MAX_PRIORITY);
        t3.start();
    }
}
